package com.hqj.demo;

public class MutilCheck extends Questions {

    private static final long serialVersionUID = -202008101743L;
    public MutilCheck() {
    }

    public MutilCheck(String text, String[] options, String type, String answer, Integer score) {
        super(text, options, type, answer, score);
    }

    @Override
    public boolean isRight(String answer) {
        //判断答案的长度
        if(answer.length()!=this.getAnswer().length()){
            return false;
        }
        //利用字符串的包含，来判断答案的正确性
        answer = answer.toUpperCase();
        this.setAnswer(this.getAnswer().toUpperCase());

        for(int i=0;i<answer.length();i++){
            char c = answer.charAt(i);
            if(!this.getAnswer().contains(c+"")){
                return false;
            }
        }
        return true;
    }
}
